package com.example.demo.mapper;

import com.example.demo.model.Teacher;

import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper

public interface TeacherMapper {

    @Select("select * from teacher")

    List<Teacher> findAll();

    @Select("select * from teacher where tel = #{tel}")

    List<Teacher> findByTel(String tel);

    @Select("select * from teacher where id = #{id}")

    Teacher get(Integer id);

    @Delete("delete from teacher where id = #{id}")

    void delete(Integer id);

    @Insert("insert into teacher(id, name,age,tel) values(#{id},  #{name},#{age},  #{tel})")

    void save(Teacher teacher);

    @Update("update teacher set name = #{name}, tel = #{tel},age=#{age} where id = #{id}")

    void update(Teacher teacher);



    List<Teacher> search(Teacher teacher);

}